/**
 * Created by Pengpeng on 2017/5/27.
 */
$(function () {
    var app = {};
    app.editor = new wangEditor("contentArea");
    app.editor.config.fontsizes = {};

    app.editor.onchange = function () {
        var url = window.location.href;
        var key = url.substring(url.lastIndexOf("/") + 1);
        url = "s/" + key;
        var content = app.editor.$txt.html();
        $.post(url, {content: content}, function (response) {
        })
    }

    app.editor.create();

    $("#pwdForm").submit(function () {
        var pwd = $("#pwd").val();
        var url = window.location.href;
        var key = url.substring(url.lastIndexOf("/") + 1);
        url = "p/" + key;
        $.post(url, {p: pwd}, function (response) {
            $("#pwdForm").reset();
            $("#pwdModal").hide();
        })
    })

    $("#submit").click(function () {
        $("#pwdForm").submit();
    })

})
